//
//  YeeUserProfile.m
//  SmallLook
//
//  Created by CoderYee on 2017/2/21.
//  Copyright © 2017年 余伟. All rights reserved.
//

#import "YeeUserProfile.h"

@implementation YeeUserProfile
+(NSDictionary *)replacedKeyFromPropertyName
{
    return @{@"ID" : @"id",@"Description":@"description"};
}

+ (instancetype)accountWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
   
    
}
/**
 *  从文件中解析对象的时候调
 */
- (id)initWithCoder:(NSCoder *)decoder
{
    if (self = [super init])
    {
        self.userToken = [decoder decodeObjectForKey:@"userToken"];
        self.userId = [decoder decodeObjectForKey:@"userId"];
    }
    return self;
}

/**
 *  将对象写入文件的时候调用
 */
- (void)encodeWithCoder:(NSCoder *)encoder
{
    if (self.userId)
    {
        [encoder encodeObject:self.userId forKey:@"userId"];
    }
    if (self.userToken)
    {   [encoder encodeObject:self.userToken forKey:@"userToken"];
    }
    
}
@end
